<template>
  <transition name="dialog-fade">
    <div class="theme-dialog_wrapper" v-show="visible">
      <div class="theme-dialog" :style="{ width: '75%', }">

        <div class="theme-dialog_body">
          <slot name="title">
            <span class="theme-dialog_title">{{ title ? title : "提示" }}</span>
          </slot>
          <slot></slot>
        </div>
        <div class="theme-dialog_footer">
          <slot name="footer"></slot>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
export default {
  props: {
    title: String,
    visible: Boolean,
  }
};
</script>

<style lang="less" scoped>
.theme-dialog_wrapper {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 2001;
  background-color: rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}
.theme-dialog {
  position: relative;
  width: 50%;
  margin: 0 auto;
  box-sizing: border-box;

  // &_header {
  //   // position: absolute;
  //   // top: -26px;
  //   // left: 50%;
  //   // transform: translateX(-50%);
  //   width: 186px;
  //   height: 48px;
  //   //background: url('../assets/img/dialog-header.png') no-repeat;
  //   background-size: cover;
  //   text-align: center;
  //   padding: 0 25px;
  //   margin: 0 auto;
  //   overflow: hidden;
  //   text-overflow: ellipsis;
  //   white-space: nowrap;
  //   box-sizing: border-box;
  //   .theme-dialog_title {
  //     font-size: 16px;
  //     font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  //     font-weight: 400;
  //     color: #d7865f;
  //   }
  // }

  &_body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    //max-height: 450px;
    color: #312e2b;
    font-size: 16px;
    word-break: break-all;
    border: 5px solid #f9a254;
    border-radius: 10px;
    background-image: repeating-radial-gradient(#fef7d6, #f5daaf);
    padding: 12px;
    margin: 0 auto;
    box-sizing: border-box;
    .theme-dialog_title {
      margin-bottom: 23px;
      font-size: 16px;
      font-family: Microsoft YaHei-Regular, Microsoft YaHei;
      font-weight: 400;
      color: #d7865f;
    }
  }

  &_footer {
    padding: 10px 20px 20px;
    text-align: right;
    box-sizing: border-box;
  }
}
</style>

<style lang="less" scoped>
.dialog-fade-enter-active {
  animation: fade 0.2s;
}

.dialog-fade-leave-active {
  animation: fade 0.2s reverse;
}

@keyframes fade {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
</style>
